/**
  @(#)$Id: AL_Error.h 69 2013-10-08 03:03:33Z xiaoting $
  @brief    	AL_AplError: all kinds of Error Log

  @author		$Author: xiaoting $
  @date			$Date: 2013-10-08 11:03:33 +0800 (周二, 08 十月 2013) $
  @version		$Revision: 69 $
  @url			$URL: https://svn.code.sf.net/p/xiaoting/game/trunk/MyProject/AL_StandardLib/groupinc/AL_Error.h $
  @header		$Header: https://svn.code.sf.net/p/xiaoting/game/trunk/MyProject/AL_StandardLib/groupinc/AL_Error.h 69 2013-10-08 03:03:33Z xiaoting $
 */
#ifndef CXX_AL_ERROR_H
#define CXX_AL_ERROR_H

///////////////////////////////////////////////////////////////////////////
//			AL_AplError
///////////////////////////////////////////////////////////////////////////
typedef long AL_ERROR;

class AL_AplError
{
public:
	/*-----------------------------------------------------------------------*/
	/**
	* @brief Record recoverable errors
	* 
	* @param[in] pkszFileInfo File information
	* @param[in] dwLineNo     Line number where the error occur
	* @param[in] ErrorCode    Error code
	* @param[in] *pkszInfoFormat	(Including format control string to 200 characters, alphanumeric characters maximum (NULL)) log information
	* @return VOID
	* @remarks If this error type is set to save to file, the errors is saved to "$Error rec media root dir$\Error\ERROR.REC".\n
	And you can use the tool BaseGroup provides to look it over. 
	If you want to get this tool, please contact BaseGroup(<em><b>fw@pset.suntec.net</b></em>).
	* @par Usage example:
	You can define the file info in the head of a file like this:
	@code
	static const NCHAR g_szErrorFileInfo[] = NTEXT("$Id: AL_Error.h 69 2013-10-08 03:03:33Z xiaoting $");
	@endcode
	Then you can use this interface like this:
	@code
	AL_ErrorLog(eErrorCode, dwOption);
	@endcode
	It can automatically add file info add line number.
	*/
	/*-----------------------------------------------------------------------*/
	static VOID ErrorRec(const NCHAR *szFileInfo, DWORD dwLineNo, AL_ERROR ErrorCode, const NCHAR* pkszInfoFormat);

	/*-----------------------------------------------------------------------*/
	/**
	* @brief Record recoverable errors
	* 
	* @param[in] pkszFileInfo File information
	* @param[in] dwLineNo     Line number where the error occur
	* @param[in] ErrorCode    Error code
	* @param[in] dwOption     Additional option
	* @return VOID
	* @remarks If this error type is set to save to file, the errors is saved to "$Error rec media root dir$\Error\ERROR.REC".\n
	And you can use the tool BaseGroup provides to look it over. 
	If you want to get this tool, please contact BaseGroup(<em><b>fw@pset.suntec.net</b></em>).
	* @par Usage example:
	You can define the file info in the head of a file like this:
	@code
	static const NCHAR g_szErrorFileInfo[] = NTEXT("$Id: AL_Error.h 69 2013-10-08 03:03:33Z xiaoting $");
	@endcode
	Then you can use this interface like this:
	@code
	AL_ErrorLog(eErrorCode, dwOption);
	@endcode
	It can automatically add file info add line number.
	*/
	/*-----------------------------------------------------------------------*/
	static VOID ErrorRec(const CHAR *szFileInfo, DWORD dwLineNo, AL_ERROR ErrorCode, DWORD dwOption = 0);

protected:
private:
	/**
	* Construction
	*
	* @param
	* @return
	*/
	AL_AplError();

	/**
	* Destruction
	*
	* @param
	* @return
	*/
	~AL_AplError(VOID);
	
	/**
	*Copy Construct
	*
	* @param const AL_AplError& cAL_AplError
	* @return
	*/
	AL_AplError(const AL_AplError& cAL_AplError);

	/**
	*Assignment
	*
	* @param const AL_AplError& cAL_AplError
	* @return AL_AplError&
	*/
	AL_AplError &operator =(const AL_AplError& cAL_AplError);


public:
protected:
private: 
};

//////////////////////////////////////////////////////////////////////////
/**
* @brief Record recoverable errors macro
* 
* If defined file info, it can automatically append the file info and line number.\n
* <b>You should use this macro instead using AL_Error::ErrorRec function directly.</b>
	AL_String strTemp(AL_Common::StringFormat(NTEXT( "[D:Av ] [Req  ] SetProfileVersion [%x][%d][%s]"), 321, 654984,NTEXT("xioating")));
	AL_ErrorLog(0xfff1, strTemp.GetString());

	AL_ErrorLog(0xfff1, strTemp.GetString());
*/
#define AL_ErrorLog(ErrorCode, pkszInfoFormat)	AL_AplError::ErrorRec(g_szErrorFileInfo, __LINE__, ErrorCode, pkszInfoFormat)

#endif // CXX_AL_ERROR_H
/* EOF */
